package com.example.hotelmanagement.rest;

import com.example.hotelmanagement.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

/**
 * TODO
 *
 * @author chenhetao
 * @version 1.0
 * @className TestController
 * @packageName com.example.hotelmanagement.rest
 * @date 2023/6/10 16:45
 */
@Tag(name = "测试接口")
@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping("/get")
    @Operation(summary = "GET测试接口")
    public CommonResult<String> testGet(){
        return CommonResult.success("GET接口测试通过");
    }

    @GetMapping("/get/RequestParam")
    @Operation(summary = "GET测试接口(RequestParam)")
    public CommonResult<String> testGet(@RequestParam("id") Long id){
        return CommonResult.success("GET接口测试通过,参数为"+id);
    }

    @PostMapping("/post")
    @Operation(summary = "POST测试接口")
    public CommonResult<String> testPost(){
        return CommonResult.success("POST测试接口通过");
    }

    @PostMapping("/post/RequestBody")
    @Operation(summary = "POST测试接口(RequestBody)")
    public CommonResult<String> testPost(@RequestBody Object obj){
        return CommonResult.success("POST测试接口通过,参数为"+obj.toString());
    }

    @PutMapping("/put")
    @Operation(summary = "PUT测试接口")
    public CommonResult<String> testPut(){
        return CommonResult.success("PUT测试接口通过");
    }

    @DeleteMapping("/delete")
    @Operation(summary = "DELETE测试接口")
    public CommonResult<String> testDelete(){
        return CommonResult.success("DELETE测试接口通过");
    }


}
